home *** CD-ROM | disk | FTP | other *** search
/ Java 1996 August / Java - Summer 1996.iso / rockridge / java / threads / betaclasses / SimpleThread.java < prev    next >
Encoding:
Text File  |  1995-11-13  |  346 b   |  15 lines

  1. class SimpleThread extends Thread {
  2.     public SimpleThread(String str) {
  3.     super(str);
  4.     }
  5.     public void run() {
  6.     for (int i = 0; i < 10; i++) {
  7.         System.out.println(i + " " + getName());
  8.             try {
  9.         sleep((int)(Math.random() * 1000));
  10.         } catch (InterruptedException e) {}
  11.     }
  12.     System.out.println("DONE! " + getName());
  13.     }
  14. }
  15.